package com.micro.modual.controller;

import com.micro.core.resp.RespJson;
import com.micro.core.resp.RespJsonData;
import com.micro.core.resp.RespJsonPageData;
import com.micro.modual.model.bo.rechargerecord.RechargeRecordBO;
import com.micro.modual.model.dto.rechargerecord.RechargeRecordDetailDTO;
import com.micro.modual.model.dto.rechargerecord.RechargeRecordListDTO;
import com.micro.modual.service.RechargeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;

import java.util.Map;

/**
 * <h1>充值记录表 控制器</h1>
 * @author levelcoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:27:47
 */
@Api(value = "充值订单管理",tags = "充值订单管理")
@RestController
@RequestMapping(value = "rechargeRecord")
public class RechargeRecordController {

    @Autowired
    private RechargeRecordService rechargeRecordService;

    /**
     * <h2>查找充值记录表 列表</h2>
     * @param params 列表查询请求对象
     * @return List<RechargeRecordListDTO> {@link RechargeRecordListDTO}s  充值记录表 列表返回对象
     */
    @ApiOperation(value = "查询充值记录表列表" ,notes = "查询充值记录表列表")
    @GetMapping(value = "/findRechargeRecordList")
    public RespJsonPageData<RechargeRecordListDTO> findRechargeRecordList(@RequestParam  Map<String,Object> params){
        return rechargeRecordService.findList(params,RechargeRecordListDTO.class);
    }

    /**
     * <h2>根据主键编号查看充值记录表详情</h2>
     * @param id  充值记录表 主键编号
     * @return {@link RechargeRecordDetailDTO}  充值记录表 详情
     */
    @ApiOperation(value = "查询充值记录表详情",notes = "根据主键编号，查询充值记录表详情")
    @GetMapping(value = "/findRechargeRecordDetail/{id}")
    public RespJsonData<RechargeRecordDetailDTO> findRechargeRecordDetail(@PathVariable("id") Long id){
        return rechargeRecordService.findDetail(id,RechargeRecordDetailDTO.class);
    }

    /**
     * <h2>新增充值记录表详情</h2>
     * @param rechargeRecordBO {@link RechargeRecordBO} 充值记录表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "新增充值记录表",notes = "新增充值记录表")
    @PostMapping(value = "/addRechargeRecord")
    public RespJson addRechargeRecord(@RequestBody RechargeRecordBO rechargeRecordBO){
        return rechargeRecordService.addRechargeRecord(rechargeRecordBO);
    }

    /**
     * <h2>修改充值记录表详情</h2>
     * @param rechargeRecordBO  {@link RechargeRecordBO} 充值记录表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "修改充值记录表",notes = "修改充值记录表")
    @PostMapping(value = "/editRechargeRecord")
    public RespJson editRechargeRecord(@RequestBody RechargeRecordBO rechargeRecordBO){
        return rechargeRecordService.editRechargeRecord(rechargeRecordBO);
    }

    /**
     * <h2>根据主键编号删除充值记录表信息</h2>
     * @param id  充值记录表 主键编号
     * @return  {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "删除充值记录表",notes = "根据地址ID，删除充值记录表")
    @PostMapping(value = "/deleteRechargeRecord/{id}")
    public RespJson deleteRechargeRecord(@PathVariable("id") Long id){
        return rechargeRecordService.deleteRechargeRecord(id);
    }
}

